package com.wtwd.device.constant;

/**
 * @author zdl
 * @date 2021/11/8 11:34
 */
public enum UserSourceEnum {
    HAIFIT("1", "app_user"), HFIT("2", "hfit_app_user"), VFIT_PRO("3", "vfitpro_app_user"), WX("50", "wx_user"), GOOGLE("51", "google_user"), APPLE("52", "apple_user");

    private String code;
    private String tableName;

    UserSourceEnum(String code, String tableName) {
        this.code = code;
        this.tableName = tableName;
    }

    public String getCode() {
        return code;
    }

    public String getTableName() {
        return tableName;
    }

    public static UserSourceEnum getUserSource(String code) {
        for (UserSourceEnum value : UserSourceEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static UserSourceEnum getUserSourceByName(String name) {
        for (UserSourceEnum value : UserSourceEnum.values()) {
            if (value.name().equals(name)) {
                return value;
            }
        }
        return null;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

}
